package cn.biplam.front.component.view.systemManage.sysprivi.role.manage;

import cn.biplam.common.paramters.UserPriviCaption;
import cn.biplam.common.wrapper.ErrorMessage;
import cn.biplam.common.wrapper.KvMap;
import cn.biplam.common.wrapper.UserInfo;
import cn.biplam.front.component.ComponentBase;
import cn.biplam.front.component.data.common.CaptionComp;
import cn.biplam.front.component.view.systemManage.sysprivi.role.manage.navi.RoleNavi;
import cn.biplam.front.component.view.systemManage.sysprivi.user.UserManage;
import cn.biplam.front.html.base.HtmlWindow;
import cn.biplam.front.template.pageFrame.mdManage.MdPage;

/**
 *  角色管理主界面
 * @author XiaoRuxing Dec 4, 200911:12:28 AM
 * @version 1.0
 */
public class RoleManageMain extends ComponentBase{

	public RoleManageMain(UserInfo user, String homeUrl, String recordId,
			KvMap<String, String> params) {
		super(user, homeUrl, recordId, params);
	}

	/**
	 *  获取角色管理主界面
	 * @param mUser    用户信息
	 * @param sHomeUrl 应用系统路径
	 * @return HtmlWindow 角色管理主界面页面
	 * @throws ErrorMessage 
	 */
	public HtmlWindow get() throws ErrorMessage{
		//创建主界面模板
		MdPage userMgPage = new MdPage(UserManage.cId,sHomeUrl,mUser);
		//设置标题信息
		userMgPage.setTitleDesc(CaptionComp.get(mUser.getUserID(), UserPriviCaption.RoleMange_Title));
		userMgPage.setTitleLogo(UserPriviCaption.RoleMange_Image);
		//设置导航栏
		userMgPage.putNavigator(_getNavi(mUser, sHomeUrl, userMgPage.getDomanID()), 
				CaptionComp.get(mUser.getUserID(), UserPriviCaption.RoleMange_NaviTitle));
		return userMgPage.get();
	}

	/**
	 *  创建用户管理导航树
	 * @throws ErrorMessage 
	 */
	private HtmlWindow _getNavi(UserInfo mUser,String sHomeUrl,
			String targetId) throws ErrorMessage{
		RoleNavi navi = new RoleNavi();
		navi.setTarget(targetId);
		HtmlWindow win = navi.get(mUser, sHomeUrl, RoleNavi.cId);
		return win;
	}
}
